package com.boe.common.util.freemark.base;

import lombok.*;
import com.boe.common.util.ClassUtil;
import com.boe.common.util.StringUtil;
import com.boe.common.util.freemark.BaseMethodModelFreemarker;
import freemarker.template.TemplateModelException;

import java.util.List;


public class FreemarkerFieldValue extends BaseMethodModelFreemarker {
    @Override
    public Object exec(List list) throws TemplateModelException {
        var paramObj = getFreemarkerParameter(list.get(0));
        var paramName = StringUtil.asString( getFreemarkerParameter(list.get(1)) );


        return ClassUtil.getValueByWbsPath(paramObj, paramName);
    }
}
